package com.wealth.commodity.web.controller;

import iaas.enums.StatusEnum;
import iaas.utils.ResultObject;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wealth.commodity.entity.Category;
import com.wealth.commodity.entity.Search;
import com.wealth.commodity.enums.GoodsStatusEnum;
import com.wealth.commodity.service.IGoodsService;
import com.wealth.commodity.service.ISearchService;
import com.wealth.commodity.vo.GoodsVO;
import com.wealth.merchant.enums.MarketEnum;
import com.wealth.system.web.controller.BaseController;



/**
 * 
 * @author Administrator
 */
@Controller
@RequestMapping(value="/downSearch")
public class DownController extends BaseController{
	
	Logger logger = Logger.getLogger(DownController.class);
	@Autowired 
	private ISearchService searchService;
	@Autowired 
	private IGoodsService goodsService;
	
	
	
	
	/**
	 * 品牌购首页(跳转)
	 * @param request
	 * @param memberid
	 * @param model
	 * @return
	 */
	@RequestMapping(value = "/list",method=RequestMethod.GET)
	public String index(HttpServletRequest request, Model model) {
		try {
			
			return "commodity/down/list";
		} catch (Exception e) {
			logger.error(e);
			return "system/500";
		}
	}
	
	
	
	@RequestMapping(value = "/Show")
	@ResponseBody
	public ResultObject searchShow(HttpServletRequest request, Model model,Integer Id) {
		
		try {
			//4 特殊线下商户的商品上架状态
			List<GoodsVO> goods=goodsService.getDownPag(GoodsStatusEnum.UP.getValue(), MarketEnum.BRAND.getValue(),Id);

			return new ResultObject("000", "查询成功", goods);
			
		} catch (Exception e) {
			logger.error("查询热搜错误"+e);
			return  new ResultObject("999", "查询错误", "");
		}
	}
	
	
	
		
	
	
}
